package fafica.br;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ContatoF
 */

public class ContatoF extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  /**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PrintWriter saida = response.getWriter();
		response.setContentType("text/html");
		
		String nome = request.getParameter("nome");
		String email = request.getParameter("email");
		String telefone = request.getParameter("telefone");
		String mensagem = request.getParameter("mensagem");
		
		saida.println("<html>");
		saida.println("<body>");
		saida.println("<h2>Detalhes do Contato</h2><br>");
		saida.println("Nome: " + nome + "<br>");
		saida.println("E-mail: " + email + "<br>");
		saida.println("Telefone: " + telefone + "<br>");
		saida.println("Mensagem: " + mensagem.replaceAll("\n", "<br>"));
		saida.println("</body>");
		saida.println("</html>");
				
	}

}
